package com.fengwk.user.face.client;

import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.fengwk.user.face.client.hystrix.RandomClientHystrix;
import com.fengwk.user.face.constant.UserServerConstant;

@FeignClient(
		name = UserServerConstant.FEIGN_CLIENT_NAME, 
		path = "/api/random",
		fallback = RandomClientHystrix.class)
public interface RandomClient {
	
	/**
	 * 生成对应用户名的随机验证码,120秒超时
	 * 
	 * @param username 用户名
	 * @return
	 */
	@PostMapping("/usernameRandom")
	String usernameRandom(
			@RequestParam(value = "username", required = true) String username);

	/**
	 * 生成对应手机号的随机验证码,发送至手机(未对接手机接口),120秒超时
	 * 
	 * @param mobilePhone 手机号码
	 * @return
	 */
	@PostMapping("/mobilePhoneRandom")
	boolean mobilePhoneRandom(
			@RequestParam(value = "mobilePhone", required = true) String mobilePhone);

	/**
	 * 生成对应邮箱的随机验证码,发送至邮箱,600秒超时
	 * 
	 * @param email 邮箱
	 * @return
	 */
	@PostMapping("/emailRandom")
	boolean emailRandom(
			@RequestParam(value = "email", required = true) String email);

	/**
	 * 验证码校验
	 * 
	 * @param identity 身份
	 * @param random 随机码
	 * @return
	 */
	@PostMapping("/checkRandom")
	boolean checkRandom(
			@RequestParam(value = "identity", required = true) String identity, 
			@RequestParam(value = "random", required = true) String random);
	
}
